#include <iostream>
#include "thread/hpp/ThreadPool.h"
#include "thread/hpp/TaskPool.h"
#include "thread/hpp/ManageThread.h"
#include "thread/hpp/ObjectMonitor.h"

ThreadPool threadPool(3,5);
TaskPool taskPool;
ManageThread manageThread;
int main() {
    manageThread.run();
    int v;
    while (true){
        cin>>v;

        for (int i = 0; i < v; ++i) {
            taskPool.AddTask(new Task(i+1));
        }

        taskPool.IncTaskCount(v);

        pthread_cond_broadcast(taskPool._condt);

        if(ManageThread::is_lock){

            pthread_cond_signal(&ManageThread::_cond);
        }

    }

    return 0;
}
